<template>
  <Modal v-model="modal" :title="title">
    <div class="dealer-pointcheck-modal scroll">
       <Form>
           <FormItem label="经销商名称:">
               <p>{{row.distributorName}}</p>
           </FormItem>
           <FormItem label="月份:">
               <p>{{row.year}}-{{row.month}}</p>
           </FormItem>
           <FormItem label="待审核进货积分:">
               <p>{{row.applyIntegral}}</p>
           </FormItem>
            <FormItem label="审定积分:">
                <InputNumber :max="1000000" :min="0" v-model="integral"></InputNumber>
           </FormItem>
       </Form>
    </div>
    <div slot="footer">
        <Button @click="modal = false" size="large" type="text">取消</Button>
        <Button @click="onSave" type="primary" size="large">确定</Button>
    </div>
</Modal>
</template>
<script>
export default {
  data() {
    return {
      id: null,
      modal: false,
      title: '积分审核',
      row: {},
      integral: ''
    };
  },
  methods: {
    openModal(row) {
      this.row = row
      this.modal = true;
      this.integral = row.applyIntegral
    },
    closeModal() {
      this.modal = false;
    },  
    onSave() {
      if (!this.integral) {
        this.$Message.info('请输入待审核积分')
        return
      }
      let params = {
        id: this.row.id,
        applyIntegral: this.integral
      }
      this.$ajaxGet('/distributor/integral/month_audit/doValidate', params).then(res => {
        this.$Message.success('审核成功')
        this.$emit('complete')
        this.closeModal()
      })
    }
  }
}
</script>

